package ru.paswd.marketprice.rest.app.repositories;

import org.springframework.data.repository.CrudRepository;
import ru.paswd.marketprice.rest.app.entity.PriceHistoryItem;
import ru.paswd.marketprice.rest.app.entity.Product;
import ru.paswd.marketprice.rest.app.entity.Shop;

import java.time.OffsetDateTime;
import java.util.List;
import java.util.UUID;

public interface PriceHistoryRepository extends CrudRepository<PriceHistoryItem, UUID> {

    List<PriceHistoryItem> findAllByShopAndProductOrderByDateTimeAsc(Shop shop, Product product);

    boolean existsByShopAndProductAndDateTime(
            Shop shop, Product product, OffsetDateTime dateTime);
}
